import  sys

# file=sys.stdout
# file.write('Hello')
#print('Hello')
file=open('hello.txt','r')
print(file.read(3))
#不需要再写close
with open('hello.txt','r',encoding='utf-8') as file2:
    print(file2.read())
    print(file2.readline())
#覆盖原来写的文件
str="day day up"
with open('hello.txt','w',encoding='utf-8') as file3:
    file3.write(str)

list3=['hello11','world22']
with open('hello.txt','w',encoding='utf-8') as file4:
    file4.writelines(list3)
file5=open('text','rb')
print(file5.read(1))
print(file5.read(1))
print(file5.tell())
print(file5.seek(2,1))